#include <stdio.h>
#include <time.h>
#include <stdlib.h>

void generatData(int i, char *name)
{
	char fullName[200] = {0};
	sprintf(fullName, "%s%d.in", name, i);
	FILE * fp = fopen(fullName, "w");
	int n = rand() % 100 + 1;
	int m = rand() % 100 + 1;
	int k = rand() % 100 + 1;
	fprintf(fp, "%d %d %d\n", n, m, k);
	for ( int i = 0; i < k; i++ )
	{
		int sex = rand() % 2;
		int no = 0;
		if ( sex == 0 )
		{
			no = rand() % n + 1;
		}
		else
		{
			no = rand() % m + 1;
		}
		fprintf(fp, "%d %d\n", sex, no);
	}
	fclose(fp);
}

int main()
{
	srand(time(NULL));
	char *name = "task";
	for ( int i = 11; i <= 20; i++)
	{
		generatData(i, name);
	}
	return 0;
}

